package com.wym.lottery.adapter;

import java.util.List;

import com.wym.lottery.model.Ticket;
import com.wym.lottery.ui.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class DataArrayAdapter extends ArrayAdapter<Ticket> {
	private int mResourceId;
	private Context context;

	public DataArrayAdapter(Context context, int resource, List<Ticket> objects) {

		super(context, resource, objects);
		mResourceId = resource;
		this.context = context;

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Ticket ticket = getItem(position);
		View view = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(mResourceId, null);
		TextView number = (TextView) view.findViewById(R.id.query_number_bydatabases);
		TextView money = (TextView) view.findViewById(R.id.query_money_bydatabases);

		number.append(ticket.getNum());
		money.append(ticket.getMoney());
		return view;

	}

}
